package com.sky.controller.user;

import com.sky.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

import java.util.concurrent.TimeUnit;

@Slf4j
@RestController("usershopcontroller")
@RequestMapping("/user/shop")
@Api(tags = "店铺相关接口")
public class ShopController {
    private  static final String key="SHOP_STATUS";

    @Autowired
    private RedisTemplate redisTemplate;

@GetMapping("/status")
@ApiOperation("查询店铺状态")
    public Result  getstatus(){
       Integer status1=(Integer)  redisTemplate.opsForValue().get(key);
    log.info("用户查看店铺状态:{}",status1==1?"营业":"打烊");

        return  Result.success(status1);
}



}
